/*
* mn10200-wii.h - mostly external addresses, functions, and such
* Copyright 2006-2008 OpenWii (admin@openwii.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* Version 2.4 by Andii
*/

#ifndef MN10200_WII
#define MN10200_WII

void taskWait(unsigned short, void*, unsigned short);	// sub_94f61
void sub_94ec3(unsigned short, void*, unsigned short);
short memcpy(unsigned short len, const unsigned char* src);	// dst passed as a0, diff calling conventions

void cmd0Handler();
void sub_83e13();
void sub_83e03();
void sub_952b0(unsigned short, void*);
void sub_9241e();
void sub_838dc();
unsigned short sub_89e6c();

extern unsigned char cmdDiBytes[];	// _loc_8308=0x8308; cmdDiByte*
extern unsigned short loc_8330;		// _loc_8330=0x8330;
extern unsigned short loc_8332;		// _loc_8332=0x8332;
extern unsigned short cmd0Flags;	// _loc_8334=0x8334; cmd0Flags
extern unsigned short loc_8336;		// _loc_8336=0x8336;
extern unsigned char loc_8346;		// _loc_8346=0x8346; *
extern unsigned char loc_8368;		// _loc_8368=0x8368; *
extern unsigned char loc_8369;		// _loc8369=0x8369; *
extern unsigned char loc_838c;		// _loc838c=0x838c; *
extern unsigned short loc_85b8;		// _loc85b8=0x85B8;
extern unsigned char loc_40030f;	// _loc40030f=0x40030F; *

// audiofix locations, special thanks to Bell (YAOSM) for providing the correct addresses
extern unsigned char aloc_85bc;
extern unsigned short aloc_85a8;
extern unsigned short aloc_837a;
extern unsigned short aloc_85c6;
extern unsigned short aloc_85be;
extern unsigned char aloc_8373;
extern unsigned short aloc_8418;
extern unsigned short aloc_8428;
void asub_85171();
void asub_851a5();
unsigned short asub_840b5(unsigned short);
void asub_91e65();
void asub_851aa(unsigned short);
void asub_8517e();

extern unsigned char emuFlag;		// 0x8598
extern unsigned char mediaFlagL;	// 0x8576
extern unsigned char mediaFlagH;	// 0x8577
extern unsigned char loginStatus;	// 0x40ba06
extern unsigned short speedFlag;

extern unsigned char maxSectorsRaw15[4];
extern unsigned char maxSectorsRaw19[4];
extern unsigned long int firstLayer1;
extern unsigned long int firstLayer2;
extern unsigned long int wholeDisc1;
extern unsigned long int wholeDisc2;

extern unsigned char ourRegion;
extern unsigned char ourSpeed;
extern unsigned char configCommandL;
extern unsigned char configCommandH;

extern unsigned char flashUpdate[];

extern void* origRetAddr;	// loop's orig return address
extern void* stackRetAddr;	// the current return address

// 10:37 <@Erant> Anyway, anything above 0xD00000 isn't accessable directly from the
//                proc, so what you do is write <your address - 0xD00000> to 0x40006C
//                and it'll mirror that address in 0x430000
extern void* volatile memmap;
extern unsigned char membuf[];

// flag to tell loop we have a backup disc
extern unsigned char backup;

// this function is in loop.c
void startBigLoop(void);

#endif	// MN10200_WII
